import 'package:flutter/cupertino.dart';

import 'circle_path.dart';

class CirclePageRoute extends PageRoute {

  CirclePageRoute({
    required this.builder,
    this.transitionDuration = const Duration(milliseconds: 500),
    this.opaque = true,
    this.barrierDismissible = false,
    this.barrierColor,
    this.barrierLabel,
    this.maintainState = true,
    this.context,
    this.centerOffset,
  });



  BuildContext? context;
  Offset? centerOffset;
  final WidgetBuilder builder;

  @override
  final Duration transitionDuration;

  @override
  final bool opaque;

  @override
  final bool barrierDismissible;

  @override
  final Color? barrierColor;

  @override
  final String ?barrierLabel;

  @override
  final bool maintainState;

  @override
  Widget buildPage(BuildContext context, Animation<double> animation,
      Animation<double> secondaryAnimation) {
    return AnimatedBuilder(
      animation: animation,
      builder: (context, child) {
        return ClipPath(
          clipper: CirclePath(animation.value, key: GlobalKey()),
          child: child,
        );
      },
      child: builder(context),
    );
  }


}